﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="VoucherFormatEdit.aspx.cs" Inherits="Main_Accounts_VoucherFormatEdit" Culture="en-GB"  %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControl" %>
<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Voucher Format Edit</title>
    <link href="../../Styles/accounts.css" rel="Stylesheet" type="text/css" />    
    <script src="../../JavaScript/ModalPopups.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">        
            function isNumberKey(control_id, evt) {
                var charCode = (evt.which) ? evt.which : event.keyCode
                if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode < 45 || charCode > 47))
                    return false;

                if (charCode == 46) {
                    var dotcount = document.getElementById(control_id).value.split('.').length - 1;
                    if (dotcount >= 1) {
                        return false;
                    }
                }
                return true;
            }
            
            function checkJournal()
            {
                var e = document.getElementById("ddlParentVoucher");
                var RadioList = document.getElementById("radioStandard");
                var strUser = e.options[e.selectedIndex].value;
                if(strUser=='4')
                { 
                    RadioList.style.visibility="visible";
                }
                else
                {
                    RadioList.style.visibility="hidden";
                } 
            }
            
            function AutoNumber()
            {
                var txtStartNumber = document.getElementById("txtStartNumber");
                var chkAutoNumber = document.getElementById("chkAutoNumber");
                var resetNo = document.getElementById("chkNewNumber");
                if(chkAutoNumber.checked==false)
                {
                    txtStartNumber.value='';
                    txtStartNumber.style.backgroundColor="#d4d0c8";  
                    resetNo.checked=false;
                    resetNo.disabled=true;                  
                    txtStartNumber.disabled=true;                      
                }
                else
                {
                    txtStartNumber.disabled=false;
                    txtStartNumber.style.backgroundColor="#ffffff"; 
                    txtStartNumber.value='1';
                    resetNo.disabled=false;                
                }            
            }
            
            function CommonNarration()
            {
                var txtnaration = document.getElementById("txtCommonNarration");
                var ChkNarration = document.getElementById("chkCommonNarration");
                if(ChkNarration.Checked == false)
                {
                    txtnaration.value='';
                    txtnaration.style.backgroundColor="#d4d0c8";
                    txtnaration.disabled=true;     
                }
                else
                {
                    txtnaration.style.backgroundColor="#ffffff";
                    txtnaration.disabled=false;    
                }
            }
            
          function RequiredField()
            {   
                if(document.getElementById("txtVoucherName").value=='')
                {
                    AlertMessage('Specify Voucher Name'); 
                    document.getElementById("txtVoucherName").focus();
                     return false; 
                }
                else if(document.getElementById("ddlParentVoucher").selectedIndex==0)
                {
                    AlertMessage('Specify Parent Voucher Types'); 
                    document.getElementById("ddlParentVoucher").focus();              
                    return false;               
                }
            }
         </script>
</head>
<body>
    <form id="form1" runat="server">
   
     <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
        <div class="divmain">
            <acc:heading ID="header1" runat="server" HeadingText="Voucher Format Edit" />               
        </div>
        <div align="center">
            <asp:Label ID="lblMsg" runat="server" Font-Bold="true"></asp:Label></div>    
        <div style="width:80%; margin-left:10%; margin-right:10%" class="tablecontent">
             <table style="width:100%; margin-bottom:10px">
                <tr>
                    <td colspan="4" class="headtd">
                        Voucher Details                    
                    </td>
                </tr>
                 <tr>
                    <td style="width:25%">
                        Voucher Name<span class="required">*</span>                    
                    </td>
                    <td style="width:30%">
                        <asp:TextBox ID="txtVoucherName" runat="server" CssClass="input" ValidationGroup="V"></asp:TextBox>    
                        <asp:RequiredFieldValidator ID="RFVtxtVoucherName" runat="server" ValidationGroup="V" ErrorMessage="*" ControlToValidate="txtVoucherName" Display="Dynamic">
                        </asp:RequiredFieldValidator>               
                    </td>
                    <td>
                        Abbreviation                    
                    </td>
                    <td>
                        <asp:TextBox ID="txtAbbreviation" runat="server" CssClass="input"></asp:TextBox>                       
                    </td>
                </tr>
                <tr>
                    <td>
                        Parent Voucher Type<span class="required">*</span>                    
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlParentVoucher" ValidationGroup="V" runat="server" CssClass="dropdown" onchange="checkJournal();" Width="145px"></asp:DropDownList>                  
                        <asp:RequiredFieldValidator ID="RFVParentVoucher" runat="server" Display="Dynamic" ErrorMessage="*" 
                                ControlToValidate="ddlParentVoucher" ValidationGroup="V" InitialValue="0" ></asp:RequiredFieldValidator>
                    </td>
                    <td colspan="2">
                        <asp:RadioButtonList ID="radioStandard" runat="server" RepeatDirection="Horizontal"  style="visibility:hidden;">
                            <asp:ListItem Text="Standard" Value="0"></asp:ListItem>
                            <asp:ListItem Text="TDS" Value="2"></asp:ListItem>
                        </asp:RadioButtonList>                
                    </td>
                </tr>
                 <tr>
                    <td>
                        Effective Date                  
                    </td>
                    <td>
                        <asp:TextBox ID="txtEffectiveDate" runat="server" CssClass="input" ValidationGroup="V"></asp:TextBox>
                        <asp:ImageButton ID="btnDate" runat="server" ImageUrl="~/Images/calendar.gif" />
                        <AjaxControl:CalendarExtender ID="cal" runat="server" PopupButtonID="btnDate" TargetControlID="txtEffectiveDate" Format="dd/MM/yyyy"></AjaxControl:CalendarExtender>
                        <AjaxControl:MaskedEditExtender ID="maskExt" runat="server" MaskType="Date" Mask="99/99/9999" TargetControlID="txtEffectiveDate"></AjaxControl:MaskedEditExtender>
                        <AjaxControl:MaskedEditValidator ID="maskValid" runat="server" ControlExtender="maskExt" InvalidValueMessage="Invalid Date" IsValidEmpty="true" Display="Dynamic" ValidationGroup="V" ControlToValidate="txtEffectiveDate"></AjaxControl:MaskedEditValidator>                                                        
                        
                    </td>
                    <td colspan="2">
                       &nbsp;             
                    </td>
                </tr>
            </table>
            
            <table style="width:100%; margin-bottom:10px">
                <tr>
                    <td colspan="3" class="headtd" style="border-top:1px solid #818181;">
                        Voucher Settings                   
                    </td>
                </tr>
                 <tr>
                    <td style="width:25%">
                        Starting Number
                    </td>
                    <td style="width:25%">
                        <asp:TextBox ID="txtStartNumber" runat="server" CssClass="inputnumber" Text="1" onkeypress="return isNumberKey(this.id,event)"></asp:TextBox>                   
                    </td>
                    <td>
                        <asp:CheckBox ID="chkAutoNumber" runat="server" Checked="true" Text="Auto Numbering" onclick="return AutoNumber();" />                   
                    </td>                    
                </tr>
                <tr>
                    <td>
                        Prefix
                    </td>
                    <td>
                        <asp:TextBox ID="txtPrefix" runat="server" CssClass="input"></asp:TextBox>                   
                    </td>
                    <td>
                        <asp:CheckBox ID="chkPrintAfterSave" runat="server" Text="Print After Save" />                   
                    </td>                    
                </tr>
                <tr>
                    <td>
                        Suffix
                    </td>
                    <td>
                        <asp:TextBox ID="txtSuffix" runat="server" CssClass="input"></asp:TextBox>                   
                    </td>
                    <td>
                        <asp:CheckBox ID="chkNewNumber" runat="server" Text="New No. Each Year" />                   
                    </td>                    
                </tr>
                <tr>
                    <td valign="top">
                        <asp:CheckBox ID="chkCommonNarration" runat="server" Text="Common Narration" onclick="return CommonNarration();" />
                    </td>
                    <td valign="top">
                        <asp:TextBox ID="txtCommonNarration" runat="server" CssClass="input" Width="144px" TextMode="MultiLine" Height="40px" Enabled="false" BackColor="#d4d0c8"></asp:TextBox>                   
                    </td>
                    <td valign="top">
                        <asp:CheckBox ID="chkEachNarration" runat="server" Text="Each A/c Narration" /><br />  
                        <asp:CheckBox ID="chkApplyReference" runat="server" Text="Apply Reference" />                 
                    </td>                    
                </tr>
            </table>
        </div>
        
         <div style="width:80%; margin-left:10%; margin-right:10%; margin-top:10px; text-align:center">
            <asp:Button ID="btnUpdate" runat="server" ValidationGroup="V" Text="Update"
            
                 CssClass="button" onclick="btnUpdate_Click" /> &nbsp;
            <asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="button" 
                 onclick="btnCancel_Click"  />
        </div>
    </form>
</body>
</html>
